package com.zq.danli;

/**
 * 懒汉式单例模式
 */
public class SingletonLanHan {
    /**
     * 构造器私有
     */
    private SingletonLanHan(){

    }

    //提供私有对象引用
    private static SingletonLanHan singletonLanHan;

    //提供公有方法返回单例对象
    public static SingletonLanHan getInstance(){
        if (singletonLanHan == null) {
            singletonLanHan=new SingletonLanHan();
        }
        return singletonLanHan;
    }
}
